package com.yootk.client;
import java.io.*;
import java.net.*;

public class HelloClient {
    public static void main(String[] args) throws Exception {
        // 连接到服务端
        Socket socket = new Socket("localhost", 9999);
        System.out.println("【HelloClient】连接到服务端...");

        // 获取输入流读取服务端发送的数据
        BufferedReader in = new BufferedReader(
                new InputStreamReader(socket.getInputStream()));

        // 读取服务端发送的消息
        String message = in.readLine();
        System.out.println("收到服务端消息：" + message);

        // 关闭连接
        in.close();
        socket.close();
        System.out.println("客户端关闭");
    }
}